package com.mes.inventory.service;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.data.entity.EntityUtils;
import com.bstek.dorado.data.provider.Page;
import com.mes.common.domain.BasicModel;
import com.mes.common.service.BasicService;
import com.mes.inventory.dao.iface.IWarehouseKeeperDao;
import com.mes.inventory.domain.WarehouseKeeper;
@Service
public class WarehouseKeeperService extends BasicService<WarehouseKeeper>{
	
	@Autowired
	private IWarehouseKeeperDao warehouseKeeperDao;
	
	//根据仓库id查询人员信息分页
		@DataProvider
		public void getWarehouseKeeper(Page<WarehouseKeeper> page, Map<String, Object> parameter){
		    if (parameter != null && !parameter.equals("") ){
		    	try {
		    		
		    		warehouseKeeperDao.getWarehouseKeeper(page, parameter);
		    	} catch (Exception e) {
		    		e.printStackTrace();
		    	}
		    }
		}
		
		
		//保存
  		@DataResolver
		public void saveWarehouseKeepers(Collection<WarehouseKeeper> warebinKeepers) throws Exception{
  			List<WarehouseKeeper> keepers = (List<WarehouseKeeper>) warebinKeepers;
 			String warehouseUid=   keepers.get(0).getWarehouseUid();
 			System.out.println(warehouseUid);
 			List<WarehouseKeeper> list = new ArrayList<WarehouseKeeper>();
 			WarehouseKeeper warehouseKeeper = new WarehouseKeeper();
 			warehouseKeeper.setWarehouseUid(warehouseUid);
 			warehouseKeeper.setObjectState(BasicModel.OBJECTSTATE_TOBEADDED);
		}
		
}
